#ifndef _TSERVER_H_
#define _TSERVER_H_
#include "tsocket.h"
#include "teventloop.h"
#include "tthreadpool.h"
#include "tnocopyable.h"
namespace tlib
{
	class TServer : TNoCopyable
	{
	public:
		TServer();
		virtual ~TServer();

		void Start(char* host, int port);

		virtual void OnConn(TSocket* sock) = 0;
		virtual void OnRecv(TSocket* sock) = 0;
		virtual void OnClose(TSocket* sock) = 0;

		void PreRecv(TSocket* sock);
	private:
		TSocket serSock_;
		TEventLoop eventLoop_[4];
		TThreadPool ioThreadPool_;
		TThreadPool bsThreadPool_;
	};
}

#endif